package com.teacher.hong.bean;

import java.util.List;

/**
 * 分页类
 */
public class Page<T> {

    private int total = 0;      //总记录数
    private int pageIndex = 1;  //当前页码
    private int pageSize;       //页大小
    private int pageCount;      //页数
    private List<T> records;    //返回的数据集合

    public Page(int pageIndex, int pageSize) {
        this.pageIndex = pageIndex;
        this.pageSize = pageSize;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
        if (total > 0) {
            this.pageCount = (int) Math.ceil((double)total / (double) pageSize);
        }
    }

    public int getPageIndex() {
        return pageIndex;
    }

    public int getPageSize() {
        return pageSize;
    }

    public int getPageCount() {
        return pageCount;
    }

    public List<T> getRecords() {
        return records;
    }

    public void setRecords(List<T> records) {
        this.records = records;
    }
}
